package com.bw.base.mvvm

import com.bw.base.entity.CodeSendEntity
import com.bw.base.entity.LoginEntity
import com.bw.base.entity.Res
import com.bw.base.entity.UserInfoEntity
import com.bw.base.net.Cons
import okhttp3.RequestBody
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.POST
import retrofit2.http.Query


interface ApiService {
    //我们需要用协程方式来请求数据 挂起函数可以被协程调用
    @POST(Cons.CODE_SEND_URL)
    suspend fun codeSend(@Query("phone")phone:String):Res<CodeSendEntity>
    //验证码登录
    @POST(Cons.LOGIN_CODE_URL)
    suspend fun loginCode(@Body body: RequestBody):Res<LoginEntity>
    //用户信息
    @GET(Cons.URL_INFO_URL)
    suspend fun userInfo():Res<UserInfoEntity>
    //修改密码
    @POST(Cons.UPDATE_PWD_URL)
    suspend fun updatePwd(@Body body: RequestBody):Res<Boolean>
}